<?php
/**
 * MyBB 1.6
 * Copyright 2010 MyBB Group, All Rights Reserved
 *
 * Website: http://mybb.com
 * License: http://mybb.com/about/license
 *
 * $Id: mod.php 5380 2011-02-21 12:04:43Z Otse $
 */
 
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("global_start", "svn_c_global_start");


function svn_c_info()
{
    return array(
	"name"			=> "svn_c",
	"description"	=> "Shows commentary of the last svn commit.",
	"website"		=> "http://ak.fm",
	"author"		=> "Steelrat",
	"authorsite"	=> "http://ak.fm",
	"version"		=> "0.95",
	"guid" 			=> "",
	"compatibility" => "*"
    );

}

function svn_c_activate()
{
    global $db;
    require "../inc/adminfunctions_templates.php";
    
    $template = '<div id="svn_c" class="smalltext">{$svn_c_hello}</div>';
    $insert_array = array(
	'title' => 'svn_c',
	'template' => $db->escape_string($template),
	'sid' => '-1',
	'version' => '1',
	'dateline' => TIME_NOW
    );
    $db->insert_query("templates", $insert_array);
    
    find_replace_templatesets("header", '#(<div id="container">)#i', "$1{\$svn_c}");
}


function svn_c_deactivate()
{
    global $db;
    require "../inc/adminfunctions_templates.php";
    
    $query = $db->query("DELETE FROM ".TABLE_PREFIX."templates WHERE title = 'svn_c'");
    find_replace_templatesets("header", '#(\{\$svn_c\})#i', "");
}

function svn_c_global_start()
{
    global $svn_c, $db;
    
    $svn_c = 'LOL';
}